package image.color;

/**
 * Used to save storage 
 * @author Shimu
 *
 */
public class Color_Binary implements Color<Color_Binary> {

	private boolean color;
	
	public Color_Binary(){
		color = false;
	}
	
	public Color_Binary(boolean color){
		this.color = color;
	}

	@Override
	public void add(Color_Binary c) {	
		// Not analogous to binary addition
		// more like an OR gate
		if ((color) || (c.color)){
			color = true;
		} else {
			color = false;
		}		
	}

	@Override
	public void subtract(Color_Binary c) {
		// this color will be on iff this color is on and c.color is off
		if ((color) && (!c.color)){
			color = true;
		} else {
			color = false;
		}
		
	}

	@Override
	public void invert() {
		if (color){
			color = false;
		} else {
			color = true;
		}		
	}

	@Override
	public int intRep() {
		// Return black if the color is on, return white if the color is off
		if (color){
			return 1;
		}
		return -1;
	}
	
	@Override
	public void scale(double scalar) {
	}

	@Override
	public void clamp() {		
	}
}
